package lg.crypto.aes
import lg.crypto.CryptAlgorithm
import lg.crypto.CryptByte
import scala.collection.mutable.ListBuffer

class AES(val key : List[AESByte]) extends CryptAlgorithm {

  // Change it to support other key lenghts
  require(key.length == 4, "")

  private def generateRoundConstant(rounds : Int = 10) : List[AESByte] = {
    var byte = AESByte(0x01)
    val zero = AESByte(0)

    var result : ListBuffer[AESByte] = ListBuffer(byte, zero, zero, zero)
    for (i <- 1 to 10) {
      byte *= 2
      result += byte
      for (j <- 1 to 3) {
        result += zero
      }
    }
    result.toList
  }

  private def generateRoundKey(rounds: Int = 10 ) : List[AESByte] = {
	val rCon : List[AESByte] = generateRoundConstant(rounds)
	val result : ListBuffer[AESByte] = ListBuffer()
	result ++= key
	
	
	
	result.toList
  }
  
  def encrypt(block : List[CryptByte]) : List[CryptByte] = {
    generateRoundKey()

    var result : List[AESByte] = List()

    result
  }

}